<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        ul,
        li{
            list-style: none;
        }
        .box{
            transform: translate(0,25%);
            width: 50rem;
            height: 20rem;
            margin: 0 auto;
        }
        .box ul{
            display: grid;
            grid-template-columns: 2fr 1fr 1fr 1fr;
            gap: 8px;
            border: 1px solid #000;
            transition: all .3s;
        }
        .item{
            height: 10rem;
            line-height: 10rem;
            text-align: center;
            background-color: pink;
        }
        /* 鼠标经过li，修改  has父亲选择器 */
        .box ul:has(.item:nth-child(1):hover){
            grid-template-columns: 2fr 1fr 1fr 1fr;
        }
        .box ul:has(.item:nth-child(2):hover){
            grid-template-columns: 1fr 2fr 1fr 1fr;
        }
        .box ul:has(.item:nth-child(3):hover){
            grid-template-columns: 1fr 1fr 2fr 1fr;
        }
        .box ul:has(.item:nth-child(4):hover){
            grid-template-columns: 1fr 1fr 1fr 2fr;
        }
    </style>
</head>
<body>
    <div class="box">
        <ul>
            <li class="item">
                <p>1</p>
            </li>
            <li class="item" style="background-color: aqua;">
                <p>2</p>
            </li>
            <li class="item" style="background-color: aquamarine;">
                <p>3</p>
            </li>
            <li class="item" style="background-color: chartreuse;">
                <p>4</p>
            </li>
        </ul>
    </div>
</body>
</html>